<?php

namespace Home\Controller;


class IndexController extends MainController {

	
	public function index()
    {
        $cModel = M('Category');
        $topCateList = $cModel->where("`parent_id`=1")->order("`node_order` DESC,`node_id` ASC")->select();
        $this->assign('topCateList',$topCateList);

        if($this->visitor == 'pc'){
            $aModel = M('Article');
            //现代风采
            $map['category_id'] = array('IN',array(4,15,16,17));
            $this->assign('xdfcList',$aModel->where($map)->order('hits DESC,category_id DESC')->field('article_id,title,add_time')->limit(5)->select());

            //历史思考
            $map['category_id'] = array('IN',array(6,21,22,23));
            $this->assign('lsskList',$aModel->where($map)->order('hits DESC,category_id DESC')->field('article_id,title,add_time')->limit(5)->select());

            //拓展视野
            $map['category_id'] = array('IN',array(5,18,19,20));
            $this->assign('tzsyList',$aModel->where($map)->order('hits DESC,category_id DESC')->field('article_id,title,add_time')->limit(5)->select());
			
			//5篇推荐文章
			$this->assign('articleList',$aModel->where("show_index=1")->order("update_time DESC")->limit(5)->select());
        }

        $this->assign('pageTitle','聊城地方馆资源平台');
        $this->theme($this->visitor)->display();
	}


}